#include "U2MemoryStdAlloc.h"

#include "U2Bitwise.h"


U2EG_NAMESPACE_USING

/*
//---------------------------------------------------------------------
template <size_t Alignment>
void* U2StdAlignedAllocPolicy<Alignment>::_allocate(size_t size, size_t alignment)
{
	assert(0 < alignment && alignment <= 128 && U2Bitwise::isPO2(alignment));

	unsigned char* p = new unsigned char[size + alignment];
	size_t offset = alignment - (size_t(p) & (alignment-1));

	unsigned char* result = p + offset;
	result[-1] = (unsigned char)offset;

	return result;
}

//---------------------------------------------------------------------
template <size_t Alignment>
void* U2StdAlignedAllocPolicy<Alignment>::_allocate(size_t size)
{
	//return _allocate(size, OGRE_SIMD_ALIGNMENT);
	return _allocate(size, 16);
}

//---------------------------------------------------------------------
template <size_t Alignment>
void U2StdAlignedAllocPolicy<Alignment>::_deallocate(void* p)
{
	if (p)
	{
		unsigned char* mem = (unsigned char*)p;
		mem = mem - mem[-1];
		delete [] mem;
	}
}
*/